import cv2

o = cv2.imread('contours.bmp')
# 图像预处理三大步
gray= cv2.cvtColor(o,cv2.COLOR_BGR2GRAY)
ret,binary = cv2.threshold(gray,127,255,cv2.THRESH_BINARY)
contours,hierarchy = cv2.findContours(binary,cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE)

# 寻找凸包
hull = cv2.convexHull(contours[0])
print('returnPoints 为默认值True时返回值hull的值：',hull)
hull2 = cv2.convexHull(contours[0],returnPoints=False)
print('returnPoints 为默认值False时返回值hull的值：',hull2)
